Skip to content

feat: Add configurable buffer names for Agentic panels#187

Open
chancez wants to merge 1 commit into
carlos-algms:mainfrom
chancez:pr/chancez/configurable_buffer_names
Open

feat: Add configurable buffer names for Agentic panels#187
chancez wants to merge 1 commit into
carlos-algms:mainfrom
chancez:pr/chancez/configurable_buffer_names

Conversation

@chancez
Copy link
Copy Markdown
Contributor

@chancez chancez commented Apr 10, 2026

I've had this locally for a while. The main motivation for me is that I'd like to change the buffer names because the buffer name is what's displayed in my terminal window/tab title. This includes the text like <S-Tab>: change mode, and such, which just clutters my terminal tabs. But I can see other uses when combined with hooks to customize the buffer name to something else like the model used, or the session "name", etc.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds per-window buffer name customization via a new windows..buffer_name option (accepts a string or a function(header_parts) -> string|nil). Introduces a resolver that pcall-calls functions, validates return types, logs errors, and falls back to the header title when needed. set_buffer_name and render_header now use the resolved name. Typed config alias and integration tests plus README/doc updates were added.

Sequence Diagram(s)

sequenceDiagram
    participant Renderer as WindowDecoration
    participant Config as Config (windows.<panel>.buffer_name)
    participant UserFn as User-defined Function
    participant Logger as Logger
    participant Buffer as Buffer/Tab

    Renderer->>Config: read buffer_name
    alt buffer_name is string
        Config-->>Renderer: string
    else buffer_name is function
        Renderer->>UserFn: call with header_parts (pcall)
        alt UserFn returns string
            UserFn-->>Renderer: string
        else UserFn returns nil or non-string
            UserFn-->>Renderer: nil
        else UserFn errors
            UserFn-->>Logger: error
            Logger-->>Renderer: notify
            Renderer-->>Config: use fallback
        end
    else buffer_name nil/absent
        Config-->>Renderer: nil (use fallback)
    end
    Renderer->>Buffer: set buffer name (resolved or fallback) and apply "(Tab N)" suffix
Loading

Possibly related PRs

Poem

🐰 I hopped through headers, sniffed each part,
A string or a function — I name with heart.
If custom falters, the title stays near,
Errors get logged, fallbacks appear.
Buffers bloom bright — a small joyful start.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature addition: configurable buffer names for Agentic panels, which is the core change across all modified files.
Description check ✅ Passed The description clearly relates to the changeset by explaining the motivation for adding configurable buffer names and the intended use cases for customizing them.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lua/agentic/config_default.lua`:
- Around line 430-432: Remove the duplicate class annotation by deleting the
repeated "@class agentic.UserConfig.Settings" doc comment in the block that
defines settings (the table assigned to settings = { ... }), leaving the
original class annotation defined earlier intact; ensure only the earlier
declaration remains so the settings table uses the existing type without
re-declaring the class.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fcaaf007-9354-43ec-845c-8c992d6aa99e

📥 Commits

Reviewing files that changed from the base of the PR and between 5234e93 and b588907.

📒 Files selected for processing (4)
  • README.md
  • lua/agentic/config_default.lua
  • lua/agentic/ui/window_decoration.lua
  • tests/integration/test_buffer_naming.lua

Comment thread lua/agentic/config_default.lua Outdated
@chancez chancez force-pushed the pr/chancez/configurable_buffer_names branch from b588907 to 9789031 Compare April 10, 2026 21:53
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lua/agentic/config_default.lua`:
- Line 435: The file ends with "return ConfigDefault" but lacks a trailing
newline; open the file containing the ConfigDefault return statement and add a
single newline character after the final "return ConfigDefault" so the file ends
with a newline (this satisfies Stylua/formatter expectations).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 577b63e4-da2b-4480-a3ef-413c8652e75d

📥 Commits

Reviewing files that changed from the base of the PR and between b588907 and 9789031.

📒 Files selected for processing (4)
  • README.md
  • lua/agentic/config_default.lua
  • lua/agentic/ui/window_decoration.lua
  • tests/integration/test_buffer_naming.lua

Comment thread lua/agentic/config_default.lua Outdated
@chancez chancez force-pushed the pr/chancez/configurable_buffer_names branch from 9789031 to ff44a86 Compare April 10, 2026 22:12
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/integration/test_buffer_naming.lua`:
- Around line 81-120: Add three new integration tests in
tests/integration/test_buffer_naming.lua covering buffer_name resolver edge
cases: (1) a windows.chat.buffer_name function that throws — call
require("agentic").setup with that function, toggle the panel, then assert
get_panel_basename("chat") falls back to the header title (starts with "󰻞
Agentic Chat"); (2) a buffer_name function that returns a non-string (e.g., nil
or number) — toggle and assert get_panel_basename("chat") falls back to the
header title; (3) two panels in the same tab configured with the same explicit
buffer_name string — open both panels (use require("agentic").setup with two
window configs or toggle them sequentially), then assert both
get_panel_basename(...) values start with that explicit name and are not
identical (ensure uniqueness to avoid rename collisions). Use the existing
patterns around require("agentic").setup, require("agentic").toggle,
child.flush(), and get_panel_basename to match the other tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2c3fcbe4-acdd-4423-9522-df832e66d7dc

📥 Commits

Reviewing files that changed from the base of the PR and between 9789031 and ff44a86.

📒 Files selected for processing (4)
  • README.md
  • lua/agentic/config_default.lua
  • lua/agentic/ui/window_decoration.lua
  • tests/integration/test_buffer_naming.lua

Comment thread tests/integration/test_buffer_naming.lua
Copy link
Copy Markdown
Owner

@carlos-algms carlos-algms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @chancez Thank you again for another contribution.

have you tried using neovim's native title handing?

opt.title = true
opt.titlelen = 0 -- do not shorten title
opt.titlestring = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")

I'm concerned that it seems off-topic for this plugin to handle the terminal title.

@chancez
Copy link
Copy Markdown
Contributor Author

chancez commented Apr 11, 2026

Hey @chancez Thank you again for another contribution.

have you tried using neovim's native title handing?

opt.title = true
opt.titlelen = 0 -- do not shorten title
opt.titlestring = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")

I'm concerned that it seems off-topic for this plugin to handle the terminal title.

I'm aware of the title setting, but the I like the behavior of using my active buffer name as my window title. Even I were to modify my opt.titlestring, I would still use the buffer name.

This change is specifically for buffer names, but part of the outcome is how that impacts my terminal title.

That being said, there's many other reasons someone may want to customize the buffer name besides my primary motivation. For example, if you have multiple tabs open each with a different agentic session, you may want to add the model name, or the session "name" into the buffer name to make it easier to distinguish between different sessions for example.

@chancez chancez force-pushed the pr/chancez/configurable_buffer_names branch from ff44a86 to 06c6b4b Compare April 20, 2026 15:19
@chancez chancez force-pushed the pr/chancez/configurable_buffer_names branch from 06c6b4b to 8583d16 Compare May 1, 2026 03:03
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@doc/agentic.txt`:
- Line 290: Replace the plain text reference "See agentic-config-headers." with
a vimdoc cross-reference using the pipe-delimited symbol format: change the
string to use |agentic-config-headers| so help navigation picks up the section;
locate the occurrence near the "See agentic-config-headers." line and update it
to "See |agentic-config-headers|."

In `@lua/agentic/ui/window_decoration.lua`:
- Around line 215-238: The buffer_name function handler currently treats a nil
return from the user-provided buffer_name as an immediate fallback (returning
fallback), leaving stale/empty names; change the behavior so that when
pcall(buffer_name, header_parts) returns ok and result == nil you return
header_text (the header name) instead of fallback, and keep the existing
type-check/log path for non-string results; apply the same change to the
duplicate block handling buffer_name at the other location (the similar code
around the second occurrence referenced in the review).

In `@README.md`:
- Around line 225-233: The MD028 lint error is caused by an unquoted blank line
breaking blockquote continuity between the "[!WARNING]" and "[!NOTE]" blocks;
fix by ensuring any blank separator lines remain inside the blockquote markers
so the entire quoted section stays continuous — update the README block
containing "[!WARNING]" and "[!NOTE]" so the blank line is prefixed with the
blockquote marker (keeping the separator quoted) rather than leaving an unquoted
empty line.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 32570bd0-08c2-4725-b9e6-cdd7004b5028

📥 Commits

Reviewing files that changed from the base of the PR and between ff44a86 and 8583d16.

📒 Files selected for processing (5)
  • README.md
  • doc/agentic.txt
  • lua/agentic/config_default.lua
  • lua/agentic/ui/window_decoration.lua
  • tests/integration/test_buffer_naming.lua

Comment thread doc/agentic.txt Outdated
Comment thread lua/agentic/ui/window_decoration.lua
Comment thread README.md Outdated
@chancez chancez force-pushed the pr/chancez/configurable_buffer_names branch from 8583d16 to 57a47c8 Compare May 18, 2026 19:29
Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
@chancez chancez force-pushed the pr/chancez/configurable_buffer_names branch from 57a47c8 to 08d07f0 Compare May 18, 2026 20:44
@chancez chancez requested a review from carlos-algms May 18, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants